Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Enhancements to hover #317

Merged
merged 24 commits into from
Jan 21, 2020
Merged

Enhancements to hover #317

merged 24 commits into from
Jan 21, 2020

Conversation

serras
Copy link
Contributor

@serras serras commented Jan 10, 2020

  • Show kinds of known types (part of #273, type variables still missing)
  • Show documentation
  • Show some literals (part of #274, literal Text and lists still missing)

@serras
Copy link
Contributor Author

serras commented Jan 10, 2020

Some functions had to be moved to a new module to prevent cyclic dependencies.

@domenkozar
Copy link
Contributor

Is there some special configuration for showing documentation?

@serras
Copy link
Contributor Author

serras commented Jan 10, 2020 via email

@serras
Copy link
Contributor Author

serras commented Jan 10, 2020

The documentation for :doc in GHCi (which uses the same code as we do here to find docs is here.

@serras
Copy link
Contributor Author

serras commented Jan 10, 2020

@cocreature could we try to get this for release 0.6? This solves a bunch of hover bugs, and complements the showing of docs in completions with showing them on hover.

Unfortunately, it seems that there's some conflict with the solution of #318. For some reason, the fixes break, and I guess this comes from my code for getting the type of literals. Maybe the tests are wrong once we have hovers for literals?

@serras
Copy link
Contributor Author

serras commented Jan 10, 2020

It turns out that some tests had to be updated. Now everything should work!

@cocreature
Copy link
Collaborator

Sorry this has to wait for the next release. Postponing releases to get in more stuff only results in them getting delayed further and further and this isn’t a regression compared to 0.0.5 so I don’t think there is a particular reason why this has to be in 0.0.6.

As for the change, I’ll take a detailed look at this PR next week.

@serras
Copy link
Contributor Author

serras commented Jan 10, 2020

That makes complete sense!

@cocreature cocreature self-assigned this Jan 13, 2020
Copy link
Collaborator

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! I’ve added a few inline comments.

src/Development/IDE/Spans/AtPoint.hs Outdated Show resolved Hide resolved
src/Development/IDE/Spans/Type.hs Outdated Show resolved Hide resolved
src/Development/IDE/Spans/Type.hs Outdated Show resolved Hide resolved
src/Development/IDE/Spans/Calculate.hs Outdated Show resolved Hide resolved
src/Development/IDE/Spans/Type.hs Outdated Show resolved Hide resolved
src/Development/IDE/Spans/Calculate.hs Outdated Show resolved Hide resolved
test/exe/Main.hs Show resolved Hide resolved
let n = unLoc v
docs <- getDocumentationTryGhc tms n
ty <- catchSrcErrors "completion" $ do
name' <- lookupName n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lookupName doesn’t work on ghc-lib. See the CPP for completions to disable this.

Copy link
Collaborator

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@cocreature cocreature merged commit 6d0b6ea into haskell:master Jan 21, 2020
@moodmosaic
Copy link
Contributor

@serras, this looks great, but some parts of the :doc are (incorrectly?) wrapped inside <code></code>

image

@serras
Copy link
Contributor Author

serras commented Jan 23, 2020

@moodmosaic thanks for the catch! The algorithm for transforming Haddock docs into Markdown is quite naïve, so it's quite easy to get a problem. I guess the best next step is to write a bug report and I'll try to have a look at it :)

@moodmosaic
Copy link
Contributor

moodmosaic commented Jan 23, 2020

@serras

algorithm for transforming Haddock docs into Markdown is quite naïve

That's fine 👍 If you want, I can open an issue for it, or even try to fix it, just let me know where that (issue) should be opened.

@serras
Copy link
Contributor Author

serras commented Jan 23, 2020

I'm not a maintainer, but I guess that using the issue tracker for the project is the best thing.

pepeiborra pushed a commit to pepeiborra/ghcide that referenced this pull request Feb 1, 2020
* Show kinds in hover

* Documentation on hover

* Enable kind tests

* Fix tests

* Print literals

* Show (some) overloaded literals

* Fix for 8.4

* Fix tests

* Do not consider literals for definitions

* Suggestions by @cocreature

* No warning for 8.4

* More fixes for 8.4

* Make it work with ghc-lib

* More fixes for warnings when compiled with ghc-lib

* More fixes to build in ghc-lib

* Try once again to build with ghc-lib

* More fixes for ghc-lib

* Fix warning with ghc-lib
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Show kinds in hover

* Documentation on hover

* Enable kind tests

* Fix tests

* Print literals

* Show (some) overloaded literals

* Fix for 8.4

* Fix tests

* Do not consider literals for definitions

* Suggestions by @cocreature

* No warning for 8.4

* More fixes for 8.4

* Make it work with ghc-lib

* More fixes for warnings when compiled with ghc-lib

* More fixes to build in ghc-lib

* Try once again to build with ghc-lib

* More fixes for ghc-lib

* Fix warning with ghc-lib
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Show kinds in hover

* Documentation on hover

* Enable kind tests

* Fix tests

* Print literals

* Show (some) overloaded literals

* Fix for 8.4

* Fix tests

* Do not consider literals for definitions

* Suggestions by @cocreature

* No warning for 8.4

* More fixes for 8.4

* Make it work with ghc-lib

* More fixes for warnings when compiled with ghc-lib

* More fixes to build in ghc-lib

* Try once again to build with ghc-lib

* More fixes for ghc-lib

* Fix warning with ghc-lib
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Show kinds in hover

* Documentation on hover

* Enable kind tests

* Fix tests

* Print literals

* Show (some) overloaded literals

* Fix for 8.4

* Fix tests

* Do not consider literals for definitions

* Suggestions by @cocreature

* No warning for 8.4

* More fixes for 8.4

* Make it work with ghc-lib

* More fixes for warnings when compiled with ghc-lib

* More fixes to build in ghc-lib

* Try once again to build with ghc-lib

* More fixes for ghc-lib

* Fix warning with ghc-lib
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants